gl: Simplify glyph cache rendering
authorMatthias Clasen <mclasen@redhat.com>
Sun, 28 Jul 2019 13:53:10 +0000 (09:53 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 28 Jul 2019 13:54:17 +0000 (09:54 -0400)
We are currently using a weird mix of pango and cairo,
but there is no need for us to go through a pango
renderer here; we can just use cairo directly.

gsk/gl/gskglglyphcache.c

index 9098c641209309d5f26657bac9af61b69ec8bcf5..9dfe045edfd0849dc7d624124aa3d0588823f8d8 100644 (file)
@@ -117,8 +117,7 @@ render_glyph (GlyphCacheKey    *key,
   cairo_surface_t *surface;
   cairo_t *cr;
   cairo_scaled_font_t *scaled_font;
-  PangoGlyphString glyph_string;
-  PangoGlyphInfo glyph_info;
+  cairo_glyph_t cairo_glyph;
   int surface_width, surface_height;
   int stride;
   unsigned char *data;
@@ -145,18 +144,14 @@ render_glyph (GlyphCacheKey    *key,
   cairo_set_scaled_font (cr, scaled_font);
   cairo_set_source_rgba (cr, 1, 1, 1, 1);
 
-  glyph_info.glyph = key->glyph;
-  glyph_info.geometry.width = value->draw_width * 1024;
+  cairo_glyph.index = key->glyph;
   if (key->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
-    glyph_info.geometry.x_offset = 0;
+    cairo_glyph.x = 0;
   else
-    glyph_info.geometry.x_offset = - value->draw_x * 1024;
-  glyph_info.geometry.y_offset = - value->draw_y * 1024;
+    cairo_glyph.x = - value->draw_x;
+  cairo_glyph.y = - value->draw_y;
 
-  glyph_string.num_glyphs = 1;
-  glyph_string.glyphs = &glyph_info;
-
-  pango_cairo_show_glyph_string (cr, key->font, &glyph_string);
+  cairo_show_glyphs (cr, &cairo_glyph, 1);
   cairo_destroy (cr);
 
   cairo_surface_flush (surface);